package base.utils;

import java.util.Date;
import java.util.Random;

/**
 * Created by lxb on 2015/12/22.
 */
public class RandemUtil {
    /**
     *
     * @param length
     * @return
     */
    public static String getRandomStringByLength(int length) {
        String base = "abcdefghijklmnopqrstuvwxyz0123456789";
        Random random = new Random();
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < length; i++) {
            int number = random.nextInt(base.length());
            sb.append(base.charAt(number));
        }
        return sb.toString();
    }

    public static void main(String[] args) {
        System.out.println(new Date().getTime());
        System.out.println(getRandomStringByLength(16));
    }
}
